package stu.sup.controller.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import stu.sup.entity.AddressInfo;
import stu.sup.entity.UserInfo;
import stu.sup.service.IUserInfoService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 本类用来演示：
 *
 * @author:Administrator
 * @data:2020/7/6 0006
 */
@Controller
public class UserInfoController {

    @Autowired
    private IUserInfoService userInfoService;

    /**
     * 查询登录用户的个人信息
     */
    @RequestMapping("/user-info")
    public String addressInfo(Model model, HttpServletRequest request){
        //查询登录账号下的所有地址
        UserInfo userInfo = userInfoService.findByUserLoginId((Integer) request.getSession().getAttribute("loginId"));
        model.addAttribute("userInfo",userInfo);
        request.getSession().setAttribute("userInfo2",userInfo);
        System.out.println("userInfo:"+userInfo);
        return "/view/user-info";
    }

    /**
     * 修改个人信息
     */
}
